var QIMAGE_DEFAULT_WIDTH_TEXT = "推荐565";
var QIMAGE_DEFAULT_HEIGHT_TEXT = "推荐420";
var AIMAGE_DEFAULT_WIDTH_TEXT = "推荐560";
var AIMAGE_DEFAULT_HEIGHT_TEXT = "推荐400";
function getLeftShowHtml(b) {
    var a = "";
    if (b.showtype == "page") {
        a += getLeftPage(b)
    } else {
        a += getLeftQuestion(b); // 显示问题
    }
    return a
}
function getLeftPage(b) {
    var a = "";
    a += '<li style="display: block;" class="num"></li>';
    a += "<li>";
    a += '<label class="desc"><span> 按钮  ' + showTipsInfo("showtips_" + b.id + "_24", "showtipsdiv_" + b.id + "_24", "tipstitle_024", "tipsinfo_024", 2) + "</span></label>";
    a += "<div>";
    a += '<input type="radio" id="qleftpagebutton1" value="0" name="qleftpagebutton" onclick="savePageButton(\'' + b.id + "')\" " + (survey.buttontype == 0 ? 'checked="checked"': "") + '> <label for="qleftpagebutton1" class="choice">使用文本按钮</label>';
    a += "<br>";
    a += '<input type="radio" id="qleftpagebutton2" value="1" name="qleftpagebutton" onclick="savePageButton(\'' + b.id + "')\" " + (survey.buttontype == 1 ? 'checked="checked"': "") + '> <label for="qleftpagebutton2" class="choice">使用图片按钮</label>';
    a += "<br>";
    a += "<br>";
    a += "</div>";
    a += "";
    a += "</li>";
    return a
}
function getLeftQuestion(m) {
    var k = "";
    var b = "";
    $("[id^=q_no_]").each(function(c) {
        var i = $(this).attr("id").split("_")[2];
        if (i == m.id) {
            b = questionPrefix + (c + 1) + "."
        }
    });
    k += '<li style="display: block;" class="num" id="qleftno">' + b + "</li>";
    k += "<li>";
    var u = (m.type == 0 ? "22": "12");
    k += '<label class="desc"><span> ' + (m.type == 0 ? "分节符描述": "问题内容") + showTipsInfo("showtips_" + m.id + "_" + u, "showtipsdiv_" + m.id + "_" + u, "tipstitle_0" + u, "tipsinfo_0" + u, 2) + " </span></label>";
    k += '<div style="position:relative">';
    k += '<script type="text/plain" id="qleftdescriptionedit">' + m.descriptionview + "<\/script>";
    k += "";
    var p = 210;
    var a = 28;
    if (m.type == 0) {
        p = 5;
        a = 52
    }
    k += '<div id="qlefteditimg" style="top:' + a + "px;display:none;left:" + p + 'px;z-index:1000;" class="help-tippop">';
    k += '<div class="pic-tiptxt">';
    k += '<i class="i-arrow"></i>';
    k += '<div class="pictab">';
    k += '<span class="closed"><a href="javascript:void(0);" onclick="showLeftImg(\'' + m.id + '\');return false;"><img src="' + ctx + '/app/design/resource/app/design/resource/images/close005.gif"></a></span>';
    k += '<p><a id="qlefteditimgtab01" onclick="showLeftImgTab(\'' + m.id + '\',\'1\');return false;" class="current" href="javascript:void(0);">本地上传</a><a id="qlefteditimgtab02" onclick="showLeftImgTab(\'' + m.id + "','2');return false;\" href=\"javascript:void(0);\">外链图片</a></p>";
    k += "</div>";
    k += '<div id="qlefteditimg01" class="piccont"><p class="t-center">单张图片限制大小2M</p><div style="width:120px; margin:10px auto 0;"><a class="btn-b" id="qleftuploadimg" ><img width="120" height="35" alt="点击上传图片"  src="' + imagePath + 'picup_btn.gif"></a></div></div>';
    k += "";
    k += '<div style="display:none;" id="qlefteditimg02" class="piccont">';
    k += "<p>请输入图片地址</p>";
    k += '<p class="mt8"><input type="text" style="width:240px" class="text" id="qlefteditimgurl">&nbsp;<a class="TextBtn" title="确定" href="javascript:void(0);" onclick="saveQImg(\'' + m.id + "');return false;\">&nbsp;确定&nbsp;</a></p>";
    k += "</div>";
    k += "</div>";
    k += "</div>";
    k += '<div id="qleftshowimg" style="top:' + a + "px;display:none;left:" + p + 'px;z-index:1000;" class="pic-show-w">';
    k += '<div class="top"></div>';
    k += '<div class="mid">';
    k += '<div class="mb8">';
    k += '<div class="titpic"><span><img id="qleftshowimgurl" class="img150" src="' + getImageUrl(m.imageurl) + '"></span></div>';
    k += '<ul class="explainpic">';
    k += "<li><input onclick=\"checkQImgType('" + m.id + '\',2)" name="qleftimagetype_' + m.id + '" ' + (m.imagetype == 2 ? 'checked="checked"': "") + ' id="qleftimagetype2_' + m.id + '" value="2" type="radio"><label for="qleftimagetype2_' + m.id + '">适应宽度</label></li>';
    k += "<li><input onclick=\"checkQImgType('" + m.id + '\',1)" name="qleftimagetype_' + m.id + '" ' + (m.imagetype == 1 ? 'checked="checked"': "") + ' id="qleftimagetype1_' + m.id + '" value="1" type="radio"><label for="qleftimagetype1_' + m.id + '">点击查看原图</label></li>';
    k += "<li><input onclick=\"checkQImgType('" + m.id + '\',3)" name="qleftimagetype_' + m.id + '" ' + (m.imagetype == 3 ? 'checked="checked"': "") + ' id="qleftimagetype3_' + m.id + '" value="3" type="radio"><label for="qleftimagetype3_' + m.id + '">原始尺寸</label></li>';
    k += "<li><input onclick=\"checkQImgType('" + m.id + '\',4)" name="qleftimagetype_' + m.id + '" ' + (m.imagetype == 4 ? 'checked="checked"': "") + ' id="qleftimagetype4_' + m.id + '" value="4" type="radio"><label for="qleftimagetype4_' + m.id + '">自定义大小</label></li>';
    k += '<li>高度<input id="qleftimageheight_' + m.id + '" value="' + (m.imagetype == 4 ? m.imageheight: QIMAGE_DEFAULT_HEIGHT_TEXT) + '" class="' + (m.imagetype == 4 ? "text": "text-gray") + '" style="width:50px;" type="text">像素</li>';
    k += '<li>宽度<input id="qleftimagewidth_' + m.id + '" value="' + (m.imagetype == 4 ? m.imagewidth: QIMAGE_DEFAULT_WIDTH_TEXT) + '" class="' + (m.imagetype == 4 ? "text": "text-gray") + '" style="width:50px;" type="text">像素</li>';
    k += "</ul>";
    k += "</div>";
    k += '<div class="t-center">';
    k += '<a href="javascript:void(0);" onclick="changeQImgType(\'' + m.id + '\');return false;" title="确定" class="TextBtn">&nbsp;确定&nbsp;</a>';
    k += "&nbsp;&nbsp;";
    k += '<a href="javascript:void(0);" onclick="deleteQImg(\'' + m.id + '\');return false;" title="删除" class="TextBtn">&nbsp;删除&nbsp;</a>';
    k += "</div>";
    k += "</div>";
    k += '<div class="bot"></div>';
    k += "</div>";
    k += "";
    k += "</div>";
    k += "</li>";
    k += "<li>";
    k += '<div class="fl w150">';
    k += '<label class="desc"><span> 题型  ' + showTipsInfo("showtips_" + m.id + "_13", "showtipsdiv_" + m.id + "_13", "tipstitle_013", "tipsinfo_013", 2) + "</span></label>";
    k += "<div>";
    k += '<select id="qleftedittype" onchange="saveType(\'' + m.id + "')\">";
    if (QuestionType[0] != null) {
        k += '<optgroup label="基本题型">';
        for (var o = 0; o < QuestionType[0].list.length; o++) {
            var w = QuestionType[0].list[o];
            var v = QuestionTypeMap[w];
            if (w != "pagebreak") {
                k += '<option value="' + v.id + '" ' + ((m.type == v.type && m.typeid == v.typeid) ? "selected": "") + ">" + v.name + "</option>"
            }
        }
        k += "</optgroup>"
    }
    if (QuestionType[0] != null) {
        k += '<optgroup label="快速题型">';
        for (var o = 0; o < QuestionType[1].list.length; o++) {
            var w = QuestionType[1].list[o];
            var v = QuestionTypeMap[w];
            k += '<option value="' + v.id + '" ' + ((m.type == v.type && m.typeid == v.typeid) ? "selected": "") + ">" + v.name + "</option>"
        }
        k += "</optgroup>"
    }
    k += "</select>";
    k += "</div>";
    k += "</div>";
    if (m.type == 6 && (m.typeid == 1 || m.typeid == 5 || m.typeid == 12 || m.typeid == 9) || ((m.type == 1 || m.type == 2) && m.typeid == 1)) {
        var e = "";
        var g = "";
        if ((m.type == 1 || m.type == 2) && m.typeid == 1) {
            g = "选项排列";
            e = "39"
        } else {
            g = (m.typeid == 12 || m.typeid == 9) ? "类型": "字段大小";
            e = m.typeid == 12 ? "21": "17"
        }
        k += '<div class="fl w100 ml15">';
        k += '<label class="desc"><span> ' + g + showTipsInfo("showtips_" + m.id + "_" + e, "showtipsdiv_" + m.id + "_" + e, "tipstitle_0" + e, "tipsinfo_0" + e, 2) + " </span></label>";
        k += "<div>";
        k += getLeftFormatHtml(m);
        k += "</div>";
        k += "</div>"
    }
    k += '<div class="clear"></div>';
    k += "</li>";
    if (m.typeid == 1 && (m.type == 1 || m.type == 2 || m.type == 41 || m.type == 42)) {
        if ((m.type == 41 || m.type == 42) && m.questions != null) {
            k += '<li class="" >';
            k += '<fieldset class="choices" style="*z-index:1">';
            k += "<legend><span> 子问题  " + showTipsInfo("showtips_" + m.id + "_40", "showtipsdiv_" + m.id + "_40", "tipstitle_040", "tipsinfo_040", 2) + "</span></legend>";
            k += '<ul id="qleftquestions">';
            k += getLeftQuestionQuestionsHtml(m);
            k += "</ul>";
            k += '<div id="questionlistPopulate" class="t-center"><input type="button" value="批量编辑" onclick="showEditMultiItem(\'' + m.id + '\',\'2\')" class="translate" id="bulkButton"></div>';
            k += "</fieldset>";
            k += "</li>"
        }
        k += '<li class="" >';
        k += '<fieldset class="choices" style="*z-index:1">';
        k += "<legend><span> 选项  " + showTipsInfo("showtips_" + m.id + "_14", "showtipsdiv_" + m.id + "_14", "tipstitle_014", "tipsinfo_014", 2) + "</span></legend>";
        k += '<ul id="qleftanswers">';
        k += getLeftQuestionAnswersHtml(m, checkPointIsHidden(m.id), checkHasotherIsHidden(m.id));
        k += "";
        k += "</ul>";
        k += '<div id="answerlistPopulate" class="t-center"><input type="button" value="批量编辑" onclick="showEditMultiItem(\'' + m.id + '\',\'1\')" class="translate" id="bulkButton" />&nbsp;&nbsp;<input type="button" value="从题库添加" class="translate" id="bulkButton" onclick="showTemplateQuestion()" /></div>';
        if (m.type == 1 || m.type == 2 || m.type == 41 || m.type == 42) {
            k += '<div class="line-solid"></div>';
            k += '<div class="fl w300 ml10">';
            k += '<legend><span class=" mb8">选项设置</span></legend>';
            k += '<input type="checkbox" ' + (checkPointIsHidden(m.id) ? "": 'checked="checked"') + " onclick=\"showPoint('" + m.id + '\');" value="" class="checkbox" id="qhaspoint_' + m.id + '">';
            k += '<label for="qhaspoint_' + m.id + '">显示分值设置</label>';
            k += showTipsInfo("showtips_" + m.id + "_45", "showtipsdiv_" + m.id + "_45", "tipstitle_045", "tipsinfo_045", 2);
            if (m.type == 1 || m.type == 2) {
                k += "<br>";
                k += '<input type="checkbox" ' + (checkHasotherIsHidden(m.id) ? "": 'checked="checked"') + " onclick=\"showHasother('" + m.id + '\');" value="" id="qhasother_' + m.id + '" class="checkbox">';
                k += '<label for="qhasother_' + m.id + '">显示半开放设置</label>';
                k += showTipsInfo("showtips_" + m.id + "_47", "showtipsdiv_" + m.id + "_47", "tipstitle_047", "tipsinfo_047", 2)
            }
            k += "</div>"
        }
        k += "</fieldset>";
        k += "</li>"
    }
    if (m.type == 6 && ((m.typeid <= 12 && m.typeid >= 9) || m.typeid == 14)) {
        k += '<li class="" id="">';
        k += '<fieldset class="choices" style="*z-index:-1">';
        k += "<legend><span> 预设  " + showTipsInfo("showtips_" + m.id + "_18", "showtipsdiv_" + m.id + "_18", "tipstitle_018", "tipsinfo_018", 2) + "</span></legend>";
        k += getLeftDefineHtml(m);
        k += "</fieldset>";
        k += "</li>"
    }
    if (m.type == 0 || (m.type == 6 && (m.typeid == 1 || m.typeid == 5))) {
        k += '<li class="" >';
        k += '<fieldset class="choices" style="*z-index:-1">';
        k += "<legend><span> 设定  </span></legend>";
        if (m.type == 0) {
            var h = "";
            var l = "";
            if (m.instruction != "") {
                h = 'checked="checked"'
            } else {
                l = 'disabled="disabled"'
            }
            k += '<input type="checkbox" onclick="checkQInstruction(\'' + m.id + '\')" value="" id="qlefteditinstructioncheck" class="checkbox" ' + h + "/>";
            k += '<label for="qlefteditinstructioncheck" class="choice">说明</label>' + showTipsInfo("showtips_" + m.id + "_23", "showtipsdiv_" + m.id + "_23", "tipstitle_023", "tipsinfo_023", 2);
            k += "<br>";
            k += '<script type="text/plain" id="qlefteditinstruction">' + ((m.instruction == null || m.instruction == "") ? "说明内容": m.instruction) + "<\/script>"
        } else {
            if (m.type == 6 && m.typeid == 5) {
                k += '<ul id="qleftanswers">';
                k += getLeftSingleOpenQuestionAnswersHtml(m);
                k += "</ul>";
                k += '<div class="line-solid"></div>'
            }
            var w = "";
            var t = "";
            var s = "";
            if (m.rangeformat == 2) {
                w = "数值范围";
                t = "最小";
                s = "最大"
            } else {
                w = "字数范围";
                t = "最少";
                s = "最多"
            }
            k += '<div class="fl w100 ml10"><select id="qlefteditrangeformat" onchange="saveRangeformat(\'' + m.id + '\')"><option value="2" ' + (m.rangeformat == 2 ? "selected": "") + '>数值范围</option><option value="1" ' + (m.rangeformat == 1 ? "selected": "") + ">字数范围</option></select></div>";
            k += '<div class="fl">';
            k += '<p><span id="qlefteditrangeminname">';
            k += t;
            k += '</span> <input type="text" class="small" id="qlefteditrangemin" value="' + ((m.rangemin == null || m.rangeformat == 0) ? "": m.rangemin) + '" onkeyup="saveQRangemin(\'' + m.id + "')\" onmouseup=\"saveQRangemin('" + m.id + "')\">";
            k += '&nbsp;&nbsp;<span id="qlefteditrangemaxname">';
            k += s;
            k += '</span> <input type="text" class="small" id="qlefteditrangemax" value="' + ((m.rangemax == null || m.rangeformat == 0) ? "": m.rangemax) + '" onkeyup="saveQRangemax(\'' + m.id + "')\" onmouseup=\"saveQRangemax('" + m.id + "')\">";
            k += "</p>";
            k += "</div>";
            k += showTipsInfo("showtips_" + m.id + "_19", "showtipsdiv_" + m.id + "_19", "tipstitle_019", "tipsinfo_019", 2);
            k += '<div class="clear"></div>'
        }
        k += "</fieldset>";
        k += "</li>"
    }
    if (m.type == 6) {
        k += "<li>";
        k += "<fieldset>";
        k += "<legend><span>问题设置</span></legend>";
        k += '<input type="checkbox" ' + (m.required == 0 ? "": 'checked="checked"') + " onclick=\"showRequired('" + m.id + '\');" value="1" id="qrequired_' + m.id + '" class="checkbox">';
        k += '<label for="qrequired_' + m.id + '" class="choice">';
        k += "<span>本题为必答题</span>";
        k += "</label>";
        k += showTipsInfo("showtips_" + m.id + "_48", "showtipsdiv_" + m.id + "_48", "tipstitle_048", "tipsinfo_048", 2);
        k += "";
        k += "";
        k += "";
        k += "";
        k += "</fieldset>";
        k += "</li>"
    }
    if (m.typeid == 3) {
        k += '<li class="">';
        k += "<fieldset>";
        k += "<legend><span> 颜色选项  " + showTipsInfo("showtips_" + m.id + "_20", "showtipsdiv_" + m.id + "_20", "tipstitle_020", "tipsinfo_020", 2) + "</span></legend>";
        k += '<div class="th-lf-key">';
        k += '<div class="th-lf-colour">';
        var r = ColorList.color;
        var d = ColorList.colorName;
        for (var o = 0; o < r.length; o++) {
            var f = "";
            if (m.answers != null) {
                for (var n = 0; n < m.answers.length; n++) {
                    if (m.answers[n].remark == r[o]) {
                        f = ' checked="checked"';
                        break
                    }
                }
            }
            k += '<div title="' + d[o] + '">';
            k += '<label for="qlefteditquestioncolor_' + o + '">';
            if (r[o] == "assortment") {
                k += '<span style="background: url(' + imagePath + 'color-bg.gif) no-repeat 0 0"></span>'
            } else {
                if (r[o] == "transparent") {
                    k += '<span style="background: url(' + imagePath + 'color-bg.gif) no-repeat 0 -24px;"></span>'
                } else {
                    k += '<span style="background: ' + r[o] + '"></span>'
                }
            }
            k += "</label>";
            k += '<input type="checkbox" id="qlefteditquestioncolor_' + o + '" ' + f + ' value="1" onclick="saveColor(\'' + m.id + "', " + o + ')">';
            k += "</div>";
            k += ""
        }
        k += "</div>";
        k += "</div>";
        k += "</fieldset>";
        k += "</li>"
    }
    k += "";
    return k
}
function getLeftQuestionQuestionsHtml(d) {
    var b = "";
    if (d.questions != null) {
        for (var a = 0; a < d.questions.length; a++) {
            var c = d.questions[a];
            b += getLeftQuestionQuestionHtml(d, c)
        }
        b += '<li id="showquestionserror" style="display:none;"><div id="showquestionserrormsg" class="warning"></div></li>'
    }
    return b
}
function getLeftQuestionQuestionHtml(c, b) {
    var a = "";
    a += '<li id="qleftquestion_' + c.id + "_" + b.id + '" class="drag-on">';
    a += '<input type="text" id="qleftquestiondescription_' + c.id + "_" + b.id + '" value="' + b.descriptionview + '" class="text statement" onmouseup="saveQQDescription(\'' + c.id + "', '" + b.id + "')\" onkeyup=\"saveQQDescription('" + c.id + "', '" + b.id + "')\" onkeydown=\"autoCreateOption(this,event,'" + c.id + "', '" + b.id + "')\" onfocus=\"checkQQDescription('" + c.id + "', '" + b.id + "')\" onpaste=\"checkMultiPaste('" + c.id + "','2')\" />";
    a += ' <a tabindex="-1" href="javascript:void(0);" onclick="addQQQuestion(\'' + c.id + "', '" + b.id + '\');return false;"><img title="添加新子问题" alt="添加" src="' + imagePath + 'add.png" class="nodrag" /></a>';
    a += ' <a tabindex="-1" href="javascript:void(0);" onclick="deleteQQQuestion(\'' + c.id + "', '" + b.id + '\');return false;"><img title="删除这个子问题" alt="删除" src="' + imagePath + 'delete.png" class="nodrag" /></a>';
    a += ' <img class="faDel" src="' + imagePath + 'drag.png" alt="拖动" title="拖动" />';
    a += "</li>";
    return a
}
function getLeftQuestionAnswersHtml(d, a, e) {
    var c = "";
    if (d.answers != null) {
        for (var b = 0; b < d.answers.length; b++) {
            c += getLeftQuestionAnswerHtml(d, d.answers[b], a, e)
        }
        c += '<li id="showanswerserror" style="display:none;"><div id="showanswerserrormsg" class="warning"></div></li>'
    }
    return c
}
function getLeftQuestionAnswerHtml(e, c, b, f) {
    var d = "";
    d += '<li id="qleftanswer_' + e.id + "_" + c.id + '" class="drag-on">';
    d += '<input style="width:155px; *width:140px;" type="text" id="qleftanswername_' + e.id + "_" + c.id + '" value="' + c.name + '" class="text statement" onmouseup="saveQAName(\'' + e.id + "', '" + c.id + "')\" onkeyup=\"saveQAName('" + e.id + "', '" + c.id + "')\" onfocus=\"checkQAName('" + e.id + "', '" + c.id + "')\" onkeydown=\"autoCreateOption(this,event,'" + e.id + "', '" + c.id + "')\" onpaste=\"checkMultiPaste('" + e.id + "','1')\" />";
    d += " ";
    d += '<input type="checkbox" ' + (c.hasother == 1 ? 'checked="checked"': "") + " onclick=\"saveQAHasother('" + e.id + "', '" + c.id + '\')" style="' + (f ? "display:none;": "") + '" title="显示半开放" value="1" id="qleftanswerhasother_' + e.id + "_" + c.id + '" />';
    d += " ";
    d += '<input type="text" id="qleftanswerpoint_' + e.id + "_" + c.id + '" value="' + c.point + '" class="ipt-fz" style="width: 30px;' + (b ? "display:none;": "") + '" onmouseup="saveQAPoint(\'' + e.id + "', '" + c.id + "')\" onkeyup=\"saveQAPoint('" + e.id + "', '" + c.id + '\')" title="输入选项分值" />';
    d += '<span id="qleftanswerimgDIV_' + e.id + "_" + c.id + '">';
    if (e.type == 41 || e.type == 42) {} else {
        d += ' <a tabindex="-1" title="图片" href="javascript:void(0);" onclick="showLeftAImg(\'' + e.id + "', '" + c.id + '\');return false;"><img width="16" height="16" alt="图片" src="' + imagePath + 'pic_16.gif" class="nodrag" /></a>'
    }
    d += '<div id="qlefteditimg_' + e.id + "_" + c.id + '" style="display:none;" class="help-tippop">';
    d += '<div class="pic-tiptxt">';
    d += '<i class="i-arrow"></i>';
    d += '<div class="pictab">';
    d += '<span class="closed"><a href="javascript:void(0);" onclick="showLeftAImg(\'' + e.id + "', '" + c.id + '\');return false;"><img src="' + imagePath + 'close005.gif"></a></span>';
    d += '<p><a id="qlefteditimg_' + e.id + "_" + c.id + '_tab01" onclick="showLeftAImgTab(\'' + e.id + "', '" + c.id + '\',\'1\')" class="current" href="javascript:void(0);">本地上传</a><a id="qlefteditimg_' + e.id + "_" + c.id + '_tab02" onclick="showLeftAImgTab(\'' + e.id + "', '" + c.id + "','2')\" href=\"javascript:void(0);\">外链图片</a></p>";
    d += "</div>";
    d += '<div id="qlefteditimg_' + e.id + "_" + c.id + '_01" class="piccont">';
    d += '<p class="t-center">单张图片限制大小2M</p><div style="width:120px; margin:10px auto 0;"><a class="btn-b" id="qleftuploadimg_' + e.id + "_" + c.id + '">点击上传图片</a></div>';
    d += "</div>";
    d += '<div style="display:none;" id="qlefteditimg_' + e.id + "_" + c.id + '_02" class="piccont">';
    d += "<p>请输入图片地址</p>";
    d += '<p class="mt8"><input type="text" style="width:240px" class="text" id= "qleftaddimgurl_' + e.id + "_" + c.id + '">&nbsp;<a class="TextBtn" title="确定" href="javascript:void(0);" onclick="saveQAImg(\'' + e.id + "', '" + c.id + "');return false;\">&nbsp;确定&nbsp;</a></p>";
    d += "</div>";
    d += "</div>";
    d += "</div>";
    d += "";
    d += '<div id="qleftshowimg_' + e.id + "_" + c.id + '" style="display:none;" class="pic-show-w">';
    d += '<div class="top"></div>';
    d += '<div class="mid">';
    d += '<div class="mb8">';
    d += '<div class="titpic"><span><img id="qleftshowimgurl_' + e.id + "_" + c.id + '" class="img150" src="' + getImageUrl(c.imageurl) + '" /></span></div>';
    d += '<ul class="explainpic">';
    d += "<li><input " + (c.imagetype == 2 ? 'checked="checked"': "") + ' value="2" onclick="checkAImgType(\'' + e.id + "','" + c.id + '\',2)" name="qleftanswerimagetype_' + e.id + "_" + c.id + '" id="qleftanswerimagetype2_' + e.id + "_" + c.id + '" type="radio"><label for="qleftanswerimagetype2_' + e.id + "_" + c.id + '">适应宽度</label></li>';
    d += "<li><input " + (c.imagetype == 1 ? 'checked="checked"': "") + ' value="1" onclick="checkAImgType(\'' + e.id + "','" + c.id + '\',1)" name="qleftanswerimagetype_' + e.id + "_" + c.id + '" id="qleftanswerimagetype1_' + e.id + "_" + c.id + '" type="radio"><label for="qleftanswerimagetype1_' + e.id + "_" + c.id + '">点击查看原图</label></li>';
    d += "<li><input " + (c.imagetype == 3 ? 'checked="checked"': "") + ' value="3" onclick="checkAImgType(\'' + e.id + "','" + c.id + '\',3)" name="qleftanswerimagetype_' + e.id + "_" + c.id + '" id="qleftanswerimagetype3_' + e.id + "_" + c.id + '" type="radio"><label for="qleftanswerimagetype3_' + e.id + "_" + c.id + '">原始尺寸</label></li>';
    d += "<li><input " + (c.imagetype == 4 ? 'checked="checked"': "") + ' value="4" onclick="checkAImgType(\'' + e.id + "','" + c.id + '\',4)" name="qleftanswerimagetype_' + e.id + "_" + c.id + '" id="qleftanswerimagetype4_' + e.id + "_" + c.id + '" type="radio"><label for="qleftanswerimagetype4_' + e.id + "_" + c.id + '">自定义大小</label></li>';
    d += '<li>高度<input id="qleftanswerimageheight_' + e.id + "_" + c.id + '" value="' + (c.imagetype == 4 ? c.imageheight: AIMAGE_DEFAULT_HEIGHT_TEXT) + '" class="' + (c.imagetype == 4 ? "text": "text-gray") + '" style="width:50px;" type="text">像素</li>';
    d += '<li>宽度<input id="qleftanswerimagewidth_' + e.id + "_" + c.id + '" value="' + (c.imagetype == 4 ? c.imagewidth: AIMAGE_DEFAULT_WIDTH_TEXT) + '" class="' + (c.imagetype == 4 ? "text": "text-gray") + '" style="width:50px;" type="text">像素</li>';
    d += "</ul>";
    d += "</div>";
    d += '<div class="t-center">';
    d += '<a href="javascript:void(0);" onclick="changeQAImgType(\'' + e.id + "', '" + c.id + '\');return false;" title="确定" class="TextBtn">&nbsp;确定&nbsp;</a>';
    d += "&nbsp;&nbsp;";
    d += '<a href="javascript:void(0);" onclick="deleteQAImg(\'' + e.id + "', '" + c.id + '\');return false;" title="删除" class="TextBtn">&nbsp;删除&nbsp;</a>';
    d += "</div>";
    d += "</div>";
    d += '<div class="bot"></div>';
    d += "</div>";
    d += "</span>";
    d += ' <a tabindex="-1" name="btn_add" title="添加" href="javascript:void(0);" onclick="addQAAnswer(\'' + e.id + "', '" + c.id + '\');return false;"><img title="添加新选项" alt="添加" src="' + imagePath + 'add.png" class="nodrag" /></a>';
    d += ' <a tabindex="-1" name="btn_del" title="删除" href="javascript:void(0);" onclick="deleteQAAnswer(\'' + e.id + "', '" + c.id + '\');return false;"><img title="删除这个选项" alt="删除" src="' + imagePath + 'delete.png" class="nodrag" /></a>';
    d += ' <img class="faDel" src="' + imagePath + 'drag.png" alt="拖动" title="拖动" />';
    d += "</li>";
    return d
}
function getLeftSingleOpenQuestionAnswersHtml(c) {
    var b = "";
    if (c.answers != null) {
        for (var a = 0; a < c.answers.length; a++) {
            b += getLeftSingleOpenQuestionAnswerHtml(c, c.answers[a])
        }
        b += '<li id="showopenanswerserror" style="display:none;"><div class="warning">选项已达到上限,不能再添加</div></li>'
    }
    return b
}
function getLeftSingleOpenQuestionAnswerHtml(d, b) {
    var c = "";
    c += '<li id="qleftanswer_' + d.id + "_" + b.id + '" class="drag-on">';
    c += '<input type="text" id="qleftanswername_' + d.id + "_" + b.id + '" onmouseup="saveQAName(\'' + d.id + "', '" + b.id + "')\" onkeyup=\"saveQAName('" + d.id + "', '" + b.id + '\')" value="' + b.name + '" class="text statement">';
    c += ' <a tabindex="-1" title="添加" href="javascript:void(0);" onclick="addOpenQAnswer(\'' + d.id + "', '" + b.id + '\');return false;"><img id="qleftopenanswer_' + d.id + "_" + b.id + '" title="添加新选项。" alt="添加" src="' + imagePath + 'add.png"></a>';
    c += ' <a tabindex="-1" title="删除" href="javascript:void(0);" onclick="deleteOpenQAnswer(\'' + d.id + "', '" + b.id + '\');return false;"><img title="删除这个选项。" alt="删除" src="' + imagePath + 'delete.png"></a>';
    c += ' <img class="faDel" src="' + imagePath + 'drag.png" alt="拖动" title="拖动">';
    c += "</li>";
    return c
}
function getLeftFormatHtml(b) {
    var a = "";
    a += '<select id="qlefteditformat" onchange="saveFormat(\'' + b.id + "')\">";
    if (b.type == 6 && (b.typeid == 1 || b.typeid == 5)) {
        a += getLeftFormatOpenOption(b)
    } else {
        if (b.type == 6 && b.typeid == 12) {
            a += getLeftFormatPhoneOption(b)
        } else {
            if (b.type == 6 && b.typeid == 9) {
                a += getLeftFormatDateOption(b)
            } else {
                if ((b.type == 1 || b.type == 2) && b.typeid == 1) {
                    a += getLeftFormatNormalOption(b)
                }
            }
        }
    }
    a += "</select>";
    return a
}
function getLeftFormatOpenOption(b) {
    var a = "";
    a += '<option value="' + QuestionFormat.small.format + '" ' + (b.format == QuestionFormat.small.format ? "selected": "") + ">" + QuestionFormat.small.name + "</option>";
    a += '<option value="' + QuestionFormat.middle.format + '" ' + (b.format == QuestionFormat.middle.format ? "selected": "") + ">" + QuestionFormat.middle.name + "</option>";
    if (b.typeid == 1 && b.type == 6) {
        a += '<option value="' + QuestionFormat.large.format + '" ' + (b.format == QuestionFormat.large.format ? "selected": "") + ">" + QuestionFormat.large.name + "</option>"
    } else {
        if (b.format == QuestionFormat.large.format) {
            b.format = QuestionFormat.small.format
        }
    }
    return a
}
function getLeftFormatPhoneOption(b) {
    var a = "";
    a += '<option value="' + QuestionFormat.call.format + '" ' + (b.format == QuestionFormat.call.format ? "selected": "") + ">" + QuestionFormat.call.name + "</option>";
    a += '<option value="' + QuestionFormat.mobile.format + '" ' + (b.format == QuestionFormat.mobile.format ? "selected": "") + ">" + QuestionFormat.mobile.name + "</option>";
    return a
}
function getLeftFormatDateOption(b) {
    var a = "";
    a += '<option value="' + QuestionFormat.ymd.format + '" ' + (b.format == QuestionFormat.ymd.format ? "selected": "") + ">" + QuestionFormat.ymd.name + "</option>";
    a += '<option value="' + QuestionFormat.ym.format + '" ' + (b.format == QuestionFormat.ym.format ? "selected": "") + ">" + QuestionFormat.ym.name + "</option>";
    return a
}
function getLeftFormatNormalOption(b) {
    var a = "";
    a += '<option value="' + QuestionFormat.v1.format + '" ' + (b.format == QuestionFormat.v1.format ? "selected": "") + ">" + QuestionFormat.v1.name + "</option>";
    a += '<option value="' + QuestionFormat.v2.format + '" ' + (b.format == QuestionFormat.v2.format ? "selected": "") + ">" + QuestionFormat.v2.name + "</option>";
    a += '<option value="' + QuestionFormat.v3.format + '" ' + (b.format == QuestionFormat.v3.format ? "selected": "") + ">" + QuestionFormat.v3.name + "</option>";
    a += '<option value="' + QuestionFormat.v4.format + '" ' + (b.format == QuestionFormat.v4.format ? "selected": "") + ">" + QuestionFormat.v4.name + "</option>";
    if (b.type == 1) {
        a += '<option value="' + QuestionFormat.select.format + '" ' + (b.format == QuestionFormat.select.format ? "selected": "") + ">" + QuestionFormat.select.name + "</option>"
    }
    return a
}
function getLeftDefineHtml(b) {
    var a = "";
    if (b.type == 6 && b.typeid == 12) {
        a += getLeftPhoneDefineHtml(b)
    } else {
        if (b.type == 6 && (b.typeid == 11 || b.typeid == 14)) {
            a += getLeftNomalDefineHtml(b)
        } else {
            if (b.type == 6 && b.typeid == 9) {
                a += getLeftDateDefineHtml(b)
            } else {
                if (b.type == 6 && b.typeid == 10) {
                    a += getLeftTimeDefineHtml(b)
                }
            }
        }
    }
    return a
}
function getLeftPhoneDefineHtml(b) {
    var a = "";
    if (b.format == 4) {
        a += '<p class="ml10" id="qlefteditdefine">' + getLeftPhoneDefineInnerHtml(b) + "</p>"
    } else {
        a += '<p class="ml10 mt8" id="qlefteditdefine">' + getLeftPhoneDefineInnerHtml(b) + "</p>"
    }
    return a
}
function getLeftPhoneDefineInnerHtml(c) {
    var b = "";
    if (c.format == 4) {
        var a = ((c.predefine == undefined || c.predefine == null) ? "": c.predefine).split(PHONE_SPLIT);
        b += '<input type="text" style="width:50px" id="qlefteditdefine1" value="' + a[0] + '" class="text statement" onmouseup="saveQPhonePredefine(\'' + c.id + "')\" onkeyup=\"saveQPhonePredefine('" + c.id + "')\">";
        b += ' <input type="text" style="width:50px" id="qlefteditdefine2" value="' + (a[1] == undefined ? "": a[1]) + '" class="text statement" onmouseup="saveQPhonePredefine(\'' + c.id + "')\" onkeyup=\"saveQPhonePredefine('" + c.id + "')\">";
        b += ' <input type="text" style="width:100px" id="qlefteditdefine3" value="' + (a[2] == undefined ? "": a[2]) + '" class="text statement" onmouseup="saveQPhonePredefine(\'' + c.id + "')\" onkeyup=\"saveQPhonePredefine('" + c.id + "')\">"
    } else {
        b += '<input type="text" id="qlefteditdefine1" value="' + ((c.predefine == undefined || c.predefine == null) ? "": c.predefine) + '" class="text statement" onmouseup="saveQPhonePredefine(\'' + c.id + "')\" onkeyup=\"saveQPhonePredefine('" + c.id + "')\">"
    }
    return b
}
function getLeftNomalDefineHtml(b) {
    var a = "";
    a += '<p class="ml10" id="qlefteditdefine"><input id="qlefteditdefinevalue" type="text" value="' + b.predefine + '" class="text statement" onmouseup="saveQNormalPredefine(\'' + b.id + "')\" onkeyup=\"saveQNormalPredefine('" + b.id + "')\"></p>";
    return a
}
function getLeftDateDefineHtml(b) {
    var a = "";
    a += '<p class="ml10" id="qlefteditdateDIV">';
    a += getLeftDateDefineInnerHtml(b);
    a += "</p>";
    return a
}
function getLeftDateDefineInnerHtml(b) {
    var a = "";
    a += '<input type=hidden id="qlefteditdate">';
    a += '<span class="fl w40"><input type="text" style="width:35px" id="qlefteditdate_year" value="' + (b.predefine == "" ? "": b.predefine.split(DATE_SPLIT)[0]) + '" class="text" /><label>年</label></span>';
    a += '<span class="fl w40"><input type="text" style="width:35px" id="qlefteditdate_month" value="' + (b.predefine == "" ? "": b.predefine.split(DATE_SPLIT)[1]) + '" class="text" /><label>月</label></span> ';
    if (b.format == 7) {} else {
        a += '<span class="fl w40"><input type="text" style="width:35px" id="qlefteditdate_day" value="' + (b.predefine == "" ? "": b.predefine.split(DATE_SPLIT)[2]) + '" class="text" /><label>日</label></span>'
    }
    a += '<span class="fl w40 mt2"><a href="javascript:void(0);" onclick="$(\'#qlefteditdate\').focus();return false;" class="btn-click" title="请选择日期"><img alt="请选择日期" src="' + imagePath + 'calendar.png" class="datepicker" id="qlefteditdateimg" /></a></span>';
    a += "";
    return a
}
function getLeftTimeDefineHtml(b) {
    var a = "";
    a += '<p class="ml10">';
    a += '<input type=hidden id="qleftedittime" />';
    a += '<span class="fl w40"><input type="text" style="width:35px" id="qlefteditdate_hour" value="' + (b.predefine == "" ? "": b.predefine.split(TIME_SPLIT)[0]) + '" class="text" /><label>时</label></span>';
    a += '<span class="fl w40"><input type="text" style="width:35px" id="qlefteditdate_minute" value="' + (b.predefine == "" ? "": b.predefine.split(TIME_SPLIT)[1]) + '" class="text" /><label>分</label></span> ';
    a += '<span class="fl w40"><input type="text" style="width:35px" id="qlefteditdate_second" value="' + (b.predefine == "" ? "": b.predefine.split(TIME_SPLIT)[2]) + '" class="text" /><label>秒</label></span>';
    a += '<span class="fl w40 mt2"><a href="javascript:void(0);" onclick="$(\'#qleftedittime\').focus();return false;" class="btn-click" title="请选择时间"><img alt="请选择时间" src="' + imagePath + 'time_16.gif" class="datepicker"  /></a></span>';
    a += "</p>";
    return a
}
function checkQQDescription(g, f) {
    var e = questionMap[g];
    var d = getQuestionFromQuestion(e, f);
    if (d != null && d.id != null) {
        var a = false;
        var b = getDefaultQuestionList();
        for (var c = 0; c < b.length; c++) {
            if (d.description == b[c].description) {
                a = true;
                break
            }
        }
        if (a && e.isedit != 1) {
            setTimeout(function() {
                $("#qleftquestiondescription_" + g + "_" + f + "").select()
            },
            50)
        }
    }
}
function checkQAName(h, g) {
    var f = questionMap[h];
    var c = getAnswerFromQuestion(f, g);
    if (c != null && c.id != null) {
        var b = false;
        if (c.hasother == 1 && c.name == "其他") {
            b = true
        } else {
            var e = getDefaultAnswerList();
            for (var d = 0; d < e.length; d++) {
                if (c.name == e[d].name) {
                    b = true;
                    break
                }
            }
        }
        if (b && f.isedit != 1) {
            setTimeout(function() {
                $("#qleftanswername_" + h + "_" + g + "").select()
            },
            50)
        }
    }
}
function checkMultiPaste(e, b) {
    var g = {};
    if (survey.comment != undefined && survey.comment != "") {
        g = $.evalJSON(survey.comment)
    }
    if (userPaste != "1" && g.edit_fisrtPasteMulti != "1") {
        var a = getPasteTips(e, b);
        var d = 0;
        var c = 0;
        var f = null;
        if (b == "2") {
            f = "#questionlistPopulate";
            d = $(f).offset().left + 105;
            c = $(f).offset().top - 28
        } else {
            f = "#answerlistPopulate";
            d = $(f).offset().left + 60;
            c = $(f).offset().top - 28
        }
        $("#overlay").after(a);
        $("#overlay").css("height", $(document).height()).show();
        $(".ctrl-v-tips").css({
            left: d + "px",
            top: c + "px"
        });
        $(document).scrollTop(c)
    }
}
function getPasteTips(c, b) {
    var a = $("<div>").addClass("ctrl-v-tips");
    a.append('<div style="position:absolute; right:-5px; top:-13px"><a title="关闭" href="javascript:void(0);" onclick="closePasteTips();return false;"><img height="31" width="29" alt="关闭" src="' + imagePath + 'close.png" /></a></div>');
    a.append('<div>当你从其他文档上复制文字来编辑选项时，你可以使用 <img height="33" width="75" style="vertical-align:-13px" src="' + imagePath + 'pl_btn.gif" /> 来快速添加。</div>');
    a.append($("<div>").addClass("mt10").append('<div class="fl gray9"><input type="checkbox" checked="checked" value="" id="editpaste" /> <label for="editpaste">不再提示</label></div>').append('<div class="fr"><a title="我知道了" href="javascript:void(0);" onclick="iKnowPasteTips();return false;"><img height="27" width="74" alt="我知道了" src="' + imagePath + 'i-see-btn.gif" /></a></div>').append('<div class="clear"></div>'));
    return a
}
function closePasteTips() {
    recordePasteTips(2)
}
function iKnowPasteTips() {
    if ($("#editpaste").is(":checked")) {
        recordePasteTips(1)
    } else {
        recordePasteTips(2)
    }
}
function closePasteTipsDiv() {
    $("#overlay").hide();
    $(".ctrl-v-tips").remove()
}
function recordePasteTips(a) {
    closePasteTipsDiv();
    if (a == 1) {
        userPaste = "1"
    } else {
        var b = {};
        if (survey.comment != undefined && survey.comment != "") {
            b = $.evalJSON(survey.comment)
        }
        b.edit_fisrtPasteMulti = "1";
        survey.comment = $.toJSON(b)
    }
    ajaxPost(ctx + "/json/survey/recordeTips", {
        sid: SURVEYID,
        tagid: 1,
        flag: a
    },
    function(c) {})
}
function checkAnswersTips(f, c) {
    var h = {};
    if (survey.comment != undefined && survey.comment != "") {
        h = $.evalJSON(survey.comment)
    }
    if (userAnswer10 != "1" && h.edit_firstAnswer10 != "1") {
        var b = getAnswersTips(f);
        var e = 0;
        var d = 0;
        var g = "#qlefteditformat";
        e = $(g).offset().left;
        var a = $(g).offset().top;
        d = a - 35;
        $("#overlay").after(b);
        $("#overlay").css("height", $(document).height()).show();
        $(".radio-select-tips").css({
            left: e + "px",
            top: d + "px"
        })
    }
}
function getAnswersTips(b) {
    var a = $("<div>").addClass("radio-select-tips");
    a.append('<div style="position:absolute; right:-10px; top:90px;" ><a href="javascript:void(0);" title="关闭"  onclick="closeAnswersTips();return false;"><img height="31" width="29" alt="关闭" src="' + imagePath + 'close.png" /></a></div>');
    a.append('<div class="radio-select-tips-txt">当选项数量较多时，您可以修改选项排列的方式为“下拉菜单”，问题将会以下拉菜单的方式展现，便于被访者答题。<p class="gray9">注意：如果您的问题选项含有图片，建议不要选用下拉菜单的形式。</p></div>');
    a.append($("<div>").addClass("mt10").append('<div class="fl gray9"><input type="checkbox" checked="checked" value="" id="editradioselecttips" /> <label for="editradioselecttips">不再提示</label></div>').append('<div class="fr"><a title="我知道了" href="javascript:void(0);" onclick="iKnowAnswersTips();return false;"><img height="27" width="74" alt="我知道了" src="' + imagePath + 'i-see-btn.gif" /></a></div>').append('<div class="clear"></div>'));
    return a
}
function closeAnswersTips() {
    recordeAnswersTips(2)
}
function iKnowAnswersTips() {
    if ($("#editradioselecttips").is(":checked")) {
        recordeAnswersTips(1)
    } else {
        recordeAnswersTips(2)
    }
}
function closeAnswersTipsDiv() {
    $("#overlay").hide();
    $(".radio-select-tips").remove()
}
function recordeAnswersTips(a) {
    closeAnswersTipsDiv();
    if (a == 1) {
        userAnswer10 = "1"
    } else {
        var b = {};
        if (survey.comment != undefined && survey.comment != "") {
            b = $.evalJSON(survey.comment)
        }
        b.edit_firstAnswer10 = "1";
        survey.comment = $.toJSON(b)
    }
    recordeTips(a, 8, SURVEYID)
}
function showPoint(b) {
    recordQuestionEdit(b);
    var a = questionMap[b];
    if ($("#qhaspoint_" + b).is(":checked")) {
        a.showpoint = 1;
        $("[id^=qleftanswerpoint_" + b + "]").show()
    } else {
        a.showpoint = 0;
        $("[id^=qleftanswerpoint_" + b + "]").hide()
    }
    questionMap[b] = a
}
function showHasother(b) {
    recordQuestionEdit(b);
    var a = questionMap[b];
    if ($("#qhasother_" + b).is(":checked")) {
        a.showhasother = 1;
        $("[id^=qleftanswerhasother_" + b + "]").show()
    } else {
        a.showhasother = 0;
        $("[id^=qleftanswerhasother_" + b + "]").hide()
    }
    questionMap[b] = a
}
function checkPointIsHidden(a) {
    return questionMap[a].showpoint != 1
}
function checkHasotherIsHidden(a) {
    return questionMap[a].showhasother != 1
}
function showRequired(b) {
    recordQuestionEdit(b);
    var a = questionMap[b];
    if ($("#qrequired_" + b).is(":checked")) {
        a.required = 1
    } else {
        a.required = 0
    }
    questionMap[b] = a
};